package com.rtx.edi.platform.rule.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rtx.edi.platform.rule.bean.PlSerialRule;

@Mapper
public interface PlSerialRuleMapper extends BaseMapper<PlSerialRule> {
	
	@Insert(" insert into pl_serial_rule (name,code,type) values (#{entity.name},#{entity.code},#{entity.type}) ")
	int addPlSerialRule(@Param("entity")PlSerialRule plSerialRule);
	
	  /**
     * 获取WMS订单号
     * @param keyname
     */
    @Select("select keycount from ncounter where keyname=#{keyname}")
    Integer selectWmskey(@Param("keyname")String keyname);

    /**
     * 插入NCOUNT
     * @param keyname
     */
    @Insert("insert into ncounter (keyname,keycount) values (#{keyname},2)")
    void insertNcounter(@Param("keyname")String keyname);

    /**
     * 更新NCOUNT
     * @param keyname
     */
    @Update("update ncounter set keycount=keycount+1 where keyname=#{keyname}")
    void updateNcounter(@Param("keyname")String keyname);

}
